# 动物类
class Animal(object):
    weight = 0

    # 初始化动物体重
    def __init__(self, weight):
        self.weight = weight

    def eat(self, food):
        pass

    def cry(self):
        pass

    def weightChange(self, num):
        if num is 1:
            self.weight += 10
            # print("体重加10")
        elif num is 2:
            self.weight -= 10
            # print("体重减10")
        else:
            self.weight -= 5
            # print("体重减5")


# 羊类（通过继承）
class Sheep(Animal):

    def __init__(self):
        Animal.__init__(self, 100)

    def cry(self):
        print("mie...")
        self.weightChange(3)

    def eat(self, food):
        if food == "grass":
            self.weightChange(1)
        else:
            self.weightChange(2)


# 老虎类（通过继承）
class Tiger(Animal):

    def __init__(self):
        Animal.__init__(self, 200)

    def cry(self):
        print("wow !!!")
        self.weightChange(3)

    def eat(self, food):
        if food == "meat":
            self.weightChange(1)
        else:
            self.weightChange(2)





